using System;
using System.Collections.Generic;
using System.Text;

using Mono.Cecil;

namespace CILDiffLibPrime.Collectors
{
    public enum ChangeResult
    {
        Same,
        Changed
    }

    public abstract class AbstractCollector
    {
        public abstract void OnCompareTypeBegin(TypeDefinition a, TypeDefinition b);
        public abstract void OnCompareTypeEnd(ChangeResult result, TypeDefinition a, TypeDefinition b);
        public abstract void OnDeletedTypes(List<TypeDefinition> types);
        public abstract void OnNewTypes(List<TypeDefinition> types);

        public abstract void OnCompareMethodBegin(MethodDefinition a, MethodDefinition b);
        public abstract void OnCompareMethodEnd(ChangeResult result, MethodDefinition a, MethodDefinition b);
        public abstract void OnDeletedMethods(TypeDefinition parent, List<MethodDefinition> methods);
        public abstract void OnNewMethods(List<MethodDefinition> methods);

        public abstract void OnCompareFields(FieldDefinition a, FieldDefinition b);
        public abstract void OnDeletedFields(List<FieldDefinition> methods);
        public abstract void OnNewFields(List<FieldDefinition> methods);

        public abstract void OnCompareProperties(PropertyDefinition a, PropertyDefinition b);
        public abstract void OnDeletedProperties(List<PropertyDefinition> properties);
        public abstract void OnNewProperties(List<PropertyDefinition> properties);

        
        protected string FormatField( FieldDefinition field )
        {
            return field.Name + ":" + field.FieldType.Name;
        }

        protected string FormatProperty( PropertyDefinition property )
        {
            return property.Name + ":" + property.PropertyType.Name;
        }

        protected string FormatMethod( MethodDefinition method )
        {
            return CILUtil.CodeProperties.GetMethodNameWithParametersTight(method,true);
        }

        protected string FormatType( TypeDefinition type )
        {
            return type.FullName;
        }
    }
}